package com.jeesite.modules.sys.wx.qy.util;

import java.io.*;

public class DeleteFile {
	public boolean delete(String path){
		File file = new File(path);
		if(!file.exists()){
			return false;
		}
		if(file.isFile()){
			return file.delete();
		}
		File[] files = file.listFiles();
		for (File f : files) {
			if(f.isFile()){
				if(!f.delete()){
					System.out.println(f.getAbsolutePath()+" delete error!");
					return false;
				}
			}else{
				if(!this.delete(f.getAbsolutePath())){
					return false;
				}
			}
		}
		return file.delete();
	}


	public static void main(String[] args)throws IOException  {
		DeleteFile t = new DeleteFile();
		File directory = new File("");// 参数为空
		String courseFile = directory.getCanonicalPath();
		String url = courseFile +File.separator + "target\\jeesite\\门店信息";
		System.out.println(t.delete(url));
	}

}